#
#  makefile - H8/300H Tinyサンプルプログラム
#
#  日付        内容
#  ----------- ------------------------------------------------
#  2009/08/21  新規作成
#
TARGET		= target
TARGET_MOT	= $(TARGET).mot
TARGET_COFF	= $(TARGET).coff
INCLUDES	= -I. -I../include/
CFLAGS		= -Wall
CFLAGS		+= -O2
CFLAGS		+= -mh
#CFLAGS		+= -g
CFLAGS		+= -mrelax
#CFLAGS		+= -mint32
CFLAGS		+= $(INCLUDES)

CC		= h8300-hms-gcc
AS		= h8300-hms-as
LD		= h8300-hms-ld

LDSCRIPT	= 36064_rom.lds
CRT0		= crt0.s
ASRCS		=	
SRCS		= main.c \
		serial.c \
		timerv.c \
		interrupt.c

all : $(TARGET_MOT)

$(TARGET_MOT): $(TARGET_COFF)
	h8300-hms-objcopy -O srec target.coff $@

$(TARGET_COFF):  $(LDSCRIPT) $(SRCS:.c=.o) $(CRT0) $(ASRCS) $(LIBS)
	$(CC) $(CFLAGS) -T $(LDSCRIPT) -nostartfiles $(CRT0) $(ASRCS) $(SRCS:.c=.o) -o $@ $(LIBS)

clean :
	rm -f $(TARGET_MOT)
	rm -f $(TARGET_COFF)
	rm -f $(SRCS:.c=.o)

